package com.webshop.demo.controller;

import com.webshop.demo.service.DemoTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by LBG on 2019/4/20.
 */
@Controller
@RequestMapping("/demo")
public class JdbcTestController {
    @Autowired
    private DemoTestService demoTestService;

    @ResponseBody
    @RequestMapping("/sayHi")
    public String sayHi(){
        String result = "hello world";//uepTestService.getHyEmployee();
        return result;
    }

    @RequestMapping("/")
    public String index(Model model){
        String result = demoTestService.getHyEmployee();
        model.addAttribute("result",result);
        //model.addAttribute(result);
        return "employee";
    }
}
